home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / snws190s.zip / SNEWS.H < prev    next >
Text File  |  1992-06-21  |  6KB  |  182 lines

  1. /*
  2.     SNEWS 1.90
  3.  
  4.     Private decls the SNEWS news reader
  5.  
  6.  
  7.     Copyright (C) 1991  John McCombs, Christchurch, NEW ZEALAND
  8.                         john@ahuriri.gen.nz
  9.                         PO Box 2708, Christchurch, NEW ZEALAND
  10.  
  11.     This program is free software; you can redistribute it and/or modify
  12.     it under the terms of the GNU General Public License, version 1, as
  13.     published by the Free Software Foundation.
  14.  
  15.     This program is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.     GNU General Public License for more details.
  19.  
  20.     See the file COPYING, which contains a copy of the GNU General
  21.     Public License.
  22.  
  23.  */
  24.  
  25. #include <alloc.h>
  26. #include <process.h>
  27. #include <io.h>
  28.  
  29.  
  30. /* #define INCLUDE_SIG */   /* enable this to have the reply function put */
  31.                             /* your sig on the reply - mail ususally does */
  32.                             /* this                                       */
  33.  
  34.  
  35.  
  36. #define ENTER               0x0D
  37. #define ESCAPE              0x1B
  38. #define TAB                 0x09
  39. #define LEFT                0x4b
  40. #define RIGHT               0x4d
  41. #define Fn1                 0x3b
  42. #define Fn2                 0x3c
  43.  
  44. #define EX_DONE             1
  45. #define EX_QUIT             2
  46. #define EX_SAVE             3
  47. #define EX_NEXT             4
  48. #define EX_NEXT_UNREAD      5
  49. #define EX_ROT13            6
  50. #define EX_DUMMY            7
  51.  
  52. #define TEXT_LINE           5
  53.  
  54.  
  55. #define PAGE_HEADER         4
  56. #define PAGE_LENGTH         19
  57.  
  58. /* if you change these see show_help */
  59. #define HELP_GROUP          0
  60. #define HELP_THREAD         1
  61. #define HELP_ARTICLES       2
  62.  
  63. #define  UP_ARR             'H'
  64. #define  DN_ARR             'P'
  65. #define  PGUP               'I'
  66. #define  PGDN               'Q'
  67. #define  HOME               'G'
  68. #define  END                'O'
  69.  
  70.  
  71.  
  72. /*
  73.  *  This structure allows the creation of linked list of article numbers
  74.  */
  75. typedef struct art_id {
  76.     long   id;                  /* article number                 */
  77.     long   art_off;             /* offset of the article          */
  78.     struct art_id *next_art;    /* pointer to next article number */
  79.     struct art_id *prev_art;    /* pointer to prev article number */
  80. } ART_ID;
  81.  
  82. /*
  83.  *  This structure is a doubly linked list of the unique article headers.  The
  84.  *  linked list of article numbers is built on 'art_num'.  This system
  85.  *  is allows flexible use of memory, but will get slower by n'ish
  86.  *  and there is a fair degree of allocation overhead in the ART_ID structure
  87.  *  But hey, it's simple
  88.  */
  89. typedef struct article {
  90.     char   header[60];          /* article header              */
  91.     int    num_articles;        /* number with this header     */
  92.     ART_ID *art_num;            /* pointer to list of articles */
  93.     struct article *next;       /* next topic                  */
  94.     struct article *last;       /* last topic                  */
  95.     int    index;               /* topic number from start     */
  96. } ARTICLE;
  97.  
  98.  
  99.  
  100.  
  101.  
  102. /*
  103.  *  This structure is a linked list of lines that make up an article. The
  104.  *  file is read in and the linked list is built
  105.  */
  106. typedef struct line {
  107.     char   data[80];            /* line of text                */
  108.     struct line *next;          /* next line                   */
  109.     struct line *last;          /* last line                   */
  110.     int    index;               /* line number from start      */
  111. } LINE;
  112.  
  113.  
  114. /*
  115.  *  This structure is the handle for an article in ram.  The file
  116.  *  is read in and the linked list built.
  117.  */
  118. #define WHO_LENGTH 50
  119. #define ORG_LENGTH 20
  120. typedef struct {
  121.     char  author[WHO_LENGTH];           /* truncated author              */
  122.     char  organisation[ORG_LENGTH];     /* truncated organisation        */
  123.     char  follow_up[80];      /* group for follow-up article             */
  124.     int   lines;              /* total lines in file                     */
  125.     LINE  *top;               /* points to start of article, incl header */
  126.     LINE  *start;             /* ponts to start of text                  */
  127. } TEXT;
  128.  
  129.  
  130.  
  131.  
  132.  
  133. ACTIVE *select_group(ACTIVE *head, ACTIVE *current);
  134. void show_help(int h);
  135. void show_values(void);
  136. int read_group(ACTIVE *gp);
  137. void show_groups(ACTIVE **top, ACTIVE *this, int force);
  138. ARTICLE *get_headers(ACTIVE *gp);
  139. void eat_gunk(char *buf);
  140. void free_header(ARTICLE *start);
  141.  
  142.  
  143. void show_threads(ACTIVE *gp, ARTICLE **top, ARTICLE *this, int force);
  144. void select_thread(ACTIVE *gp, ARTICLE *head);
  145. int read_thread(ACTIVE *gp, ARTICLE *this, ART_ID *first, int a_ct);
  146.  
  147. int count_unread_in_thread(ACTIVE *gp, ARTICLE *a);
  148. int count_unread_in_group(ACTIVE *gp);
  149. void mark_group_as_read(ACTIVE *gp);
  150.  
  151. void command(char *msg);
  152. void message(char *msg);
  153. void lmessage(char *msg);
  154.  
  155. TEXT *load_article(char *fnx, long offset);
  156. void free_article(TEXT *t);
  157.  
  158.  
  159. int read_article(ACTIVE *gp, TEXT *tx, char *subject, int a_ct, int of_ct);
  160. void show_article(ACTIVE *gp, TEXT *tx, char *subject, LINE *this, int a_ct,
  161.                   int of_ct);
  162.  
  163.  
  164. void save_to_disk(TEXT *tx);
  165. void reply_to_article(TEXT *tx, char *subject);
  166. void get_his_stuff(TEXT *tx, char *author, char *msg_id);
  167.  
  168.  
  169. void post(TEXT *tx, char *newsgroups, char *subject);
  170. void post_it(FILE *article, char *newsgroups, char *subject, char *dist,
  171.                   char *msg_id);
  172.  
  173. void rot13(TEXT *tx);
  174.  
  175. void expand_tabs(char *buf, int max_len);
  176.  
  177. int newsgroups_valid(char *ng);
  178.  
  179. void mail_to_someone(TEXT *tx);
  180.  
  181. void save_thread_to_disk(ACTIVE *gp, ARTICLE *this);
  182.